package com.yuxi.Dao.Impl;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.yuxi.Dao.InformationSourceDao;
import com.yuxi.Entity.InformationSource;

@Repository
public class InformationSourceDaoImpl extends BaseDaoImpl<Serializable, Serializable> implements InformationSourceDao {
	private Logger logger=LoggerFactory.getLogger(InformationSourceDaoImpl.class);
	public InformationSourceDaoImpl(){
		super(InformationSource.class);
	}
	@Override
	public InformationSource getInformationSource(Integer informationSourceID) {
		// TODO Auto-generated method stub
		return (InformationSource) super.get(informationSourceID);
	}

	@Override
	public InformationSource addInformationSource(InformationSource iSource) {
		// TODO Auto-generated method stub
		return (InformationSource) super.addAndReturn(iSource);
	}

	@Override
	public void deleteInformationSourcer(InformationSource iSource) {
		// TODO Auto-generated method stub
		super.delete(iSource);
	}

	@Override
	public void modiflyInformationSource(InformationSource iSource) {
		// TODO Auto-generated method stub
		super.update(iSource);
	}
	@Override
	public List<InformationSource> getAllInformationSource() {
		// TODO Auto-generated method stub
		List<InformationSource> informationSources=super.find("from InformationSource");
		return  informationSources;
	}
	@Override
	public int getCountSource(Integer superId) {
		return super.execute("select count(id) from informationSource where superId =?", superId);
	}
	@Override
	public List<InformationSource> getSourceBysuperId(Integer superId) {
		
		return super.find("from InformationSource where superId=? order by level",superId);
	}

}
